<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateGoodsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('goods', function (Blueprint $table) {
            $table->id();
            $table->string('goods_bn',50)->index()->comment('货号');
            $table->string('goods_name', 255)->nullable()->comment('商品名称');
            $table->string('goods_alias', 255)->nullable()->comment('商品简称');
            $table->string('part_bn',255)->nullable()->comment('料号');
            $table->float('sale_price',8,2)->default(0)->comment('销售价');
            $table->float('cost_price',8,2)->default(0)->comment('成本价');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('goods');
    }
}
